<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>点名器</title>
    <style>
        #box {
            height: 400px;
            width: 500px;
            background-color: aqua;
            display: flex;
            flex-direction: column;
            align-items: center;
            border-radius: 20px;
        }

        #text {
            height: 220px;
            width: 400px;
            margin: 10px;
            margin-top: 40px;
            font-size: 50px;
            font-weight: bold;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: white;
            border-radius: 20px;
        }

        #start,
        #stop {
            height: 50px;
            width: 100px;
            margin: 5px;
            font-size: 20px;
            border-radius: 10px;
        }
    </style>
</head>

<body>
    <div id="box">
        <div id="text"></div>
        <button id="start">开始</button>
        <button id="stop">结束</button>
    </div>
</body>
<script>
    let names = ["辗迟","火麟飞","曹焱兵","萧炎","闻人翊悬"];
    let textEle = document.getElementById("text");
    let startbtnEle = document.getElementById("start");
    let stopbtnEle = document.getElementById("stop");
    let timer;
    startbtnEle.addEventListener("click", function () {
        this.disabled = true;
        timer = setInterval(function () {
            let orderName = Math.floor(Math.random()*names.length);
            textEle.innerText=names[orderName];
        },10);
    });
    stopbtnEle.addEventListener("click", function () {
        startbtnEle.disabled = false;
        clearInterval(timer);
    })
</script>

</html>